#include <bits/stdc++.h>
using namespace std;
int num[1000][7];

int main() {
	int n;
	cin >> n;
	int ans[7] = {0, 0, 0, 0, 0, 0, 0};
	int price[7];
	for (int i = 0; i < 7; ++i) {
		cin >> price[i];
	}
	for (int i = 0; i < n; ++i) {
		int flag = 7;
		for (int j = 0; j < 7; ++j) {
			cin >> num[i][j];

			for (int k = 0; k < 7; ++k) {
				if (price[k] == num[i][j]) {
					flag--;
				}
			}
		}
		if (flag != 7)
			ans[flag]++;
	}
	for (int i = 0; i < 7; ++i) {
		cout << ans[i] << ' ';
	}

	return 0;
}